class OrderBeautyItem < ActiveRecord::Base
	belongs_to :order_beauty
	belongs_to :beauty_item
	has_many :staff_beauty_relations, dependent: :destroy
  	has_many :staffs, through: :staff_beauty_relations

  	enum status: %w(未服务 服务中 已服务)

	after_create :cal_sub_total

	def cal_sub_total
  	  update_attributes(sub_total: self.qty*self.beauty_item.amount)
	end
end
